<template>
  <demo-section>
    <a9-audio ref="audio" :src="src" />
    <demo-block title="播放控制">
      <a9-button type="primary" @click="play">播放</a9-button>
      <a9-button type="danger" @click="pause">暂停</a9-button>
    </demo-block>
  </demo-section>
</template>

<script>
export default {
  data () {
    return {
      src: 'https://oss.waperidea.cn/A9/audio/audio.mp3'
    }
  },
  methods: {
    play () {
      this.$refs.audio.play()
    },
    pause () {
      this.$refs.audio.pause()
    }
  }
}
</script>

<style lang="less">
@import '../../../libs/vant/var';

.demo-audio {
  .a9-button {
    margin-right: @padding-md;
  }

  .van-doc-demo-block {
    padding: 0 @padding-md;
  }

  .van-doc-demo-block__title {
    padding-left: 0;
  }
}
</style>
